<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>

  <div id="app">

    <h1 v-color="'blue'">gp18</h1>

  </div>


  <script>


    Vue.directive('color', {
      inserted(el, options) {
        console.log('inserted:', arguments)
        el.style[options.name] = options.value;
      }
    })

    var vm = new Vue({
      el: "#app",
      data: {
        username: 'hanye',
        age: 20
      }
    })


  </script>

</body>

</html>